package com.yoomiito.app.adapter


import android.text.TextUtils
import androidx.constraintlayout.widget.ConstraintLayout
import android.view.View
import android.widget.ImageView
import android.widget.TextView

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.yoomiito.app.R
import com.yoomiito.app.model.bean.OrderInfo
import com.yoomiito.app.utils.AllCode
import com.yoomiito.app.utils.ImageLoader
import com.yoomiito.app.utils.ResUtil
import com.yoomiito.app.utils.SpannableUtils

class PendingOrderAdapter() : BaseQuickAdapter<OrderInfo, BaseViewHolder>(R.layout.item_pending_order) {

    override fun convert(helper: BaseViewHolder, item: OrderInfo) {
        //订单图标
        val orderIdTv = helper.getView<TextView>(R.id.item_goods_order_id)
        orderIdTv.text = "订单：" + item.orderId
        //商品图
        val goodsPicIv = helper.getView<ImageView>(R.id.item_goods_order_pic)
        ImageLoader.getInstance().into(goodsPicIv.context, item.item_picture, goodsPicIv, R.drawable.goods_default)

        //商品title
        val goodsTitleTv = helper.getView<TextView>(R.id.item_goods_order_title)
        goodsTitleTv.text = item.nickname

        //订单时间
        val orderDateTv = helper.getView<TextView>(R.id.item_goods_order_date)
        orderDateTv.text = item.orderTime

        //订单价格
        val priceTv = helper.getView<TextView>(R.id.item_goods_order_price)
        priceTv.text = "¥" + item.money

        //订单状态
        val orderStatusTv = helper.getView<TextView>(R.id.item_goods_order_status)
        orderStatusTv.setTextColor(if (7 == item.status) ResUtil.getColor(R.color.color_balk_999999) else ResUtil.getColor(R.color.color_orange))
//        orderStatusTv.setTextColor(ResUtil.getColor(R.color.color_orange))
        var status = item.statusStr
        orderStatusTv.text = status

    }

}
